package com.rankeiot.platform.domain;

import java.io.Serializable;
import java.util.Date;
import java.sql.Types;


import com.fasterxml.jackson.annotation.JsonIgnore;

import com.rankeiot.core.data.IScoped;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.sagacity.sqltoy.config.annotation.Entity;
import org.sagacity.sqltoy.config.annotation.Id;
import org.sagacity.sqltoy.config.annotation.Column;


/**
 * 组织机构
 * @author desire
 */
@Schema(description = "组织机构")
@Data
@Entity(tableName = "t_branch",comment = "组织机构")
public class Branch implements Serializable, IScoped {
    public static final String TABLE = "t_branch";

    /**
     * 主键
     */
    @Schema(description = "ID")
    @Id(strategy = "identity")
    @Column(name = "id", length = 20L, type = Types.INTEGER, nullable = false,comment = "ID")
    private Long id;
    /**
     * 内部编码,编码方式为祖级IDs和自身ID以｜拼接,并以｜结尾
     */
    @Schema(description = "内部编码")
    @Length(max = 20)
    @Column(name = "sn", length = 20L, type = Types.VARCHAR, nullable = false,comment = "内部编码")
    private String sn;
    /**
     * 父级ID
     */
    @Schema(description = "父级ID")
    @Column(name = "pid", length = 20L, type = Types.VARCHAR)
    private Long pid;
    /**
     * 机构代码
     */
    @Schema(description = "机构代码")
    @NotNull
    @Length(max = 40)
    @Column(name = "code", length = 40L, type = Types.VARCHAR, nullable = false)
    private String code;
    /**
     * 名称
     */
    @Schema(description = "名称")
    @NotNull
    @Length(max = 40)
    @Column(name = "name", length = 40L, type = Types.VARCHAR, nullable = false)
    private String name;
    /**
     * 全称
     */
    @Schema(description = "机构全称")
    @NotNull
    @Length(max = 40)
    @Column(name = "full_name", length = 40L, type = Types.VARCHAR, nullable = false)
    private String fullName;
    /**
     * 类型
     */
    @Schema(description = "机构类型")
    @NotNull
    @Length(max = 10)
    @Column(name = "type", length = 10L, type = Types.VARCHAR, nullable = false)
    private String type;
    /**
     * 负责人
     */
    @Schema(description = "机构负责人")
    @Length(max = 40)
    @Column(name = "leader", length = 40L, type = Types.VARCHAR)
    private String leader;
    /**
     * 联系电话
     */
    @Schema(description = "联系电话")
    @Length(max = 40)
    @Column(name = "phone", length = 40L, type = Types.VARCHAR)
    private String phone;
    /**
     * 电子邮箱
     */
    @Schema(description = "电子邮箱")
    @Length(max = 100)
    @Column(name = "email", length = 100L, type = Types.VARCHAR)
    private String email;
    /**
     * 传真
     */
    @Schema(description = "传真")
    @Length(max = 20)
    @Column(name = "fax", length = 20L, type = Types.VARCHAR)
    private String fax;
    /**
     * 联系地址
     */
    @Schema(description = "联系地址")
    @Length(max = 100)
    @Column(name = "address", length = 100L, type = Types.VARCHAR)
    private String address;
    /**
     * 备注信息
     */
    @Schema(description = "备注信息")
    @Length(max = 255)
    @Column(name = "remark", length = 255L, type = Types.VARCHAR)
    private String remark;
    /**
     * 邮政编码
     */
    @Schema(description = "邮政编码")
    @Length(max = 40)
    @Column(name = "zipcode", length = 40L, type = Types.VARCHAR)
    private String zipcode;
    /**
     * 顺序
     */
    @Schema(description = "排序")
    @Column(name = "sort_rank", length = 10L, type = Types.INTEGER)
    private Integer sortRank;
    /**
     * 启用/禁用
     */
    @Schema(description = "是否启用")
    @Length(max = 1)
    @Column(name = "enable", length = 1L, type = Types.CHAR)
    private String enable;
    /**
     * 最后更新时间
     */
    @Column(name = "update_time", length = 26L, type = Types.TIMESTAMP)
    private Date updateTime;
    /**
     * 创建时间
     */
    @Column(name = "create_time", length = 26L, type = Types.TIMESTAMP)
    private Date createTime;
    /**
     * 创建用户
     */
    @Length(max = 20)
    @Column(name = "create_user", length = 20L, type = Types.VARCHAR)
    private String createUser;
    /**
     * 更改用户
     */
    @Length(max = 20)
    @Column(name = "update_user", length = 20L, type = Types.VARCHAR)
    private String updateUser;
    /**
     * 等级
     */
    @Length(max = 2)
    @Column(name = "level", length = 2L, type = Types.VARCHAR)
    private String level;

    @JsonIgnore
    private String scope;
}
